﻿<script src="~/vue/dist/vue.global.js"></script>
<link href="~/element-plus/dist/index.css" rel="stylesheet" />
<script src="~/element-plus/dist/index.full.js"></script>
<script src="~/axios/dist/axios.js"></script>
<script src="~/lib/microsoft/signalr/dist/browser/signalr.js"></script>
<html>
<head>
    <link href="~/css/table.css" rel="stylesheet" />
</head>
<body>
    <div id="app">
        <table width="100%">
            <tr>
                <td>
                    <font color="black">
                        您正在做的业务是:人力资源管理--薪酬发放管理--薪酬发放登记审核
                    </font>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>

        <el-table :data="tableData" border style="width: 100%;background-color: #ffffbb;">
            <el-table-column prop="salaryGrantId" label="薪酬发放编号"></el-table-column>
            <el-table-column prop="firstKindName" label="I级机构名称"></el-table-column>
            <el-table-column prop="secondKindName" label="II级机构名称"></el-table-column>
            <el-table-column prop="thirdKindName" label="III级机构名称"></el-table-column>
            <el-table-column prop="humanAmount" label="人数"></el-table-column>
            <el-table-column prop="salaryPaidSum" label="基本薪酬总额(元)"></el-table-column>
            <el-table-column label="复核">
                <template #default="scope">
                    <el-button size="small" v-on:click="handleEdit(scope.row.salaryGrantId)">
                        复核
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <div id="pageDiv">
            <span class="span1">  总数：{{pageCount}} 例    当前第{{pageIndex}}页 /每页显示 {{pageSize}} 条    共 {{page}} 页  </span>
            <div class="div">
                <button v-on:click="HomePage()">首页</button>
                <button v-on:click="PreviousPage()">上一页</button>
                <button v-on:click="NextPage()">下一页</button>
                <button v-on:click="LastPage()">尾页</button>
                跳到第
                <input type="text" style="width: 30px;height: 20px;" v-model="pages">
                <a>页</a>
                <button v-on:click="GoTo()">
                    <img src="~/images/go.bmp" />
                </button>
            </div>
        </div>
    </div>
</body>
</html>
<style>
    body {
        background-color: #ffffcc;
    }

    #pageDiv {
        padding: 10px;
    }

    .div {
        width: 410px;
        height: 25px;
        margin-left: 400px;
        margin-top: -26px;
        line-height: 25px;
    }

    .span1 {
        font-size: 15px;
    }

    .div button {
        margin: 0 5px;
        background-color: #00000000;
        border: 0px;
    }

    .div a {
        margin: 0 5px;
    }

    a {
        text-decoration: none;
        color: white;
    }

    tbody, td, tfoot, th, thead, tr {
        border-color: inherit;
        background-color: #ffffbb;
        border-style: solid;
        border-width: 0;
    }
</style>
<script>
    const { createApp, ref, reactive,computed } = Vue
    const { ElNotification } = ElementPlus
    var app = createApp({
        setup() {
            const tableData = ref([])
            const pageCount = ref()//总记录数
            const pageIndex = ref(1)//当前页数
            const pageSize = ref(5)//每页显示数
            const page = computed(() => {
                return Math.ceil(pageCount.value / pageSize.value)
            });//总页数
            const pages = ref()//跳转到的页数

            function fill(){
                axios.get("/SG/SGSelectFnYe",{
                    params:{
                        currentPage:pageIndex.value,
                        pageSize:pageSize.value
                    }
                }).then(res =>{
                    tableData.value = res.data.list
                    pageCount.value = res.data.rows
                }).catch(Error =>{
                    console.info(Error)
                })
            }

            //首页
            function HomePage() {
                pageIndex.value = 1;
                fill();
            }

            //上一页
            function PreviousPage() {
            if (pageIndex.value != 1) {
                    pageIndex.value -= 1;
                    fill();
                }
            }

            //下一页
            function NextPage() {
            if (pageIndex.value != page.value) {
                    pageIndex.value += 1;
                    fill();
                }
            }

            //尾页
            function LastPage() {
                pageIndex.value = page.value;
                fill();
            }


            //转到页数
            function GoTo() {
                if (!isNaN(pages.value)) {
                    if (pages.value > page.value || pages.value < 1) {
                        alert("输入的页数有误！")
                        pages.value = ""
                    } else {
                        pageIndex.value = Number(pages.value)
                        pages.value = ""
                        fill();
                    }
                } else {
                    alert('你输入的不是数字！')
                }
            }

            function handleEdit(row){
                window.location.href = "/SG/SGReviewPage?id="+row
            }
            fill();


            return {
                tableData,pageCount,pageIndex,pageSize,page,pages,HomePage,LastPage,NextPage,PreviousPage,GoTo,handleEdit,fill
            }
        }
    })
    app.use(ElementPlus)
    app.mount("#app");
</script>                 